package com.xcx.eduservice.controller.aclcontroller;

import com.xcx.commonuntils.returnuntls.ReturnMessage;
import com.xcx.commonuntils.returnuntls.ReturnMessageUtils;

import com.xcx.eduservice.entity.aclentity.Role;

import com.xcx.eduservice.service.RoleService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-01-12
 */
@Api(tags = "角色管理系统")
@RestController
@RequestMapping("/acl/role")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
@CrossOrigin
public class RoleController {

    @Autowired
    final private RoleService roleService;





    @ApiOperation(value = "根据用户获取角色数据")
    @PostMapping("toAssign")
    public ReturnMessage<List<Role>> toAssign(String userId) {

        roleService.toAssignRole(userId);

        return ReturnMessageUtils.success();
    }

//    @ApiOperation(value = "根据用户分配角色")
//    @PostMapping("/doAssign")
//    public ReturnMessage<User> doAssign(@RequestParam String userId, @RequestParam String[] roleId) {
//        roleService.saveUserRoleRealtionShip(userId, roleId);
//        return ReturnMessageUtils.success();
//    }
}

